

import logging,yagmail,yaml,json


def log_set():
    logging.basicConfig(filename='log.txt',filemode='w+',level=logging.DEBUG, format='%(asctime)s -> %(levelname)s -> %(message)s')


def send_mail(filepath):
    mail = yagmail.SMTP(user='774877770@qq.com', password="fjvmkwjdijkfbajg", host='smtp.qq.com')
    mail.send(to='774877770@qq.com',subject='测试报告', contents='今日报告，请查看', attachments=filepath)


def datayaml(filepath):
    with open(filepath, 'r', encoding='utf-8') as f:
        return yaml.safe_load(f)


def datajson(filepath):
    with open(filepath, 'r', encoding='utf-8') as f:
        return json.load(f)